﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using ServBus.ListForm2010.Setup.Utilities;

namespace ServBus.ListForm2010.Setup.Validators
{
    public class SharePointValidator : BaseValidator
    {
        public override string CheckItemText
        {
            get { return Properties.Resources.CheckingSharePoint; }
        }

        public override string ValidText
        {
            get { return Properties.Resources.CheckPassSharePoint; }
        }

        public override string InvalidText
        {
            get { return Properties.Resources.CheckFailSharePoint; }
        }

        public override void Validate()
        {
            this.Validated = false;
            RegistryKey key = Registry.LocalMachine.OpenSubKey(Constants.WSSPATH);
            if (key != null)
            {
                string value = Convert.ToString(key.GetValue("SharePoint"));
                if (value == "Installed")
                    this.Validated = true;
            }
        }
    }
}
